//	--------------------------------------------------------------------
//	Copyright(C) 2006,2007 Zhao Yukun. All rights reserved.
//	This file is a part of the Xeres system.
//	Xeres 2007
//	Contact : xeres.engine@gmail.com
//	$(reservedInfo)
//	$(reservedDeclaration)
//	--------------------------------------------------------------------
///	@file	<EntityManager.cpp>
///	@path	~/src/scene/
///	@date	2007/11/14
///	@desc	Manages entities' loading, placing, leaving & releasing.

#include "config/config.h"

#include "lib/utilities/debug.h"
#include "lib/utilities/observer.h"
#include "lib/system/thread_debug.h"

#include "scene/EntityManager.h"

namespace xeres {

	// ctor
	EntityManager::EntityManager( void )
	{
	}

	// dtor
	EntityManager::~EntityManager( void )
	{
	}

	// Initialize
	void EntityManager::Initialize( void )
	{

	}
	// Finalize
	void EntityManager::Finalize( void )
	{

	}
	// get entity from ID
	RefPass< IEntity > EntityManager::EntityFromID( EntityID id )
	{
		TRACK_FUNCTION_SCOPE();

		EntityMap::iterator it = m_entities.find( id );
		if( it == m_entities.end() )
			return NULL;
		else
			return RefPass< IEntity >( it->second );
	}
	// Tick
	void EntityManager::Tick( const Frame& frame )
	{
		TRACK_FUNCTION_SCOPE();
		RUNNING_ON_THREAD( _S("tick") );

		COUNTER_GUARD( _S("entity") );
	}

} // namespace xeres
